home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / internet / sweeper / samples / olecon~1 / controls / template / autotmpl.cpp < prev    next >
Text File  |  1995-11-25  |  4KB  |  132 lines

  1. //=--------------------------------------------------------------------------=
  2. // <<DEFOBJECTTRUNCNAME>>Obj.Cpp
  3. //=--------------------------------------------------------------------------=
  4. // Copyright  1995  Microsoft Corporation.  All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // the <<DEFOBJECTNAME>> object
  13. //
  14. //
  15. #include "IPServer.H"
  16.  
  17. #include "LocalObj.H"
  18. #include "<<DEFOBJECTNAME>>Obj.H"
  19.  
  20.  
  21. // for ASSERT and FAIL
  22. //
  23. SZTHISFILE
  24.  
  25. //=--------------------------------------------------------------------------=
  26. // C<<DEFOBJECTNAME>>::Create
  27. //=--------------------------------------------------------------------------=
  28. // creates a new <<DEFOBJECTNAME>> object.
  29. //
  30. // Parameters:
  31. //    IUnknown *        - [in] controlling unkonwn
  32. //
  33. // Output:
  34. //    IUnknown *        - new object.
  35. //
  36. // Notes:
  37. //
  38. IUnknown *C<<DEFOBJECTNAME>>::Create
  39. (
  40.     IUnknown *pUnkOuter
  41. )
  42. {
  43.     // make sure we return the private unknown so that we support aggegation
  44.     // correctly!
  45.     //
  46.     C<<DEFOBJECTNAME>> *pNew = new C<<DEFOBJECTNAME>>(pUnkOuter);
  47.     return pNew->PrivateUnknown();
  48. }
  49.  
  50. //=--------------------------------------------------------------------------=
  51. // C<<DEFOBJECTNAME>>::C<<DEFOBJECTNAME>>
  52. //=--------------------------------------------------------------------------=
  53. // create the object and initialize the refcount
  54. //
  55. // Parameters:
  56. //    IUnknown *    - [in] controlling unknown
  57. //
  58. // Notes:
  59. //
  60. #pragma warning(disable:4355)  // using 'this' in constructor
  61. C<<DEFOBJECTNAME>>::C<<DEFOBJECTNAME>>
  62. (
  63.     IUnknown *pUnkOuter
  64. )
  65. : CAutomationObject(pUnkOuter, OBJECT_TYPE_OBJ<<DEFOBJECTNAMECAPS>>, (void *)this)
  66. {
  67.  
  68.     // TODO: initialize anything here
  69.  
  70. }
  71. #pragma warning(default:4355)  // using 'this' in constructor
  72.  
  73. //=--------------------------------------------------------------------------=
  74. // C<<DEFOBJECTNAME>>::C<<DEFOBJECTNAME>>
  75. //=--------------------------------------------------------------------------=
  76. // "We all labour against our own cure, for death is the cure of all diseases"
  77. //    - Sir Thomas Browne (1605 - 82)
  78. //
  79. // Notes:
  80. //
  81. C<<DEFOBJECTNAME>>::~C<<DEFOBJECTNAME>> ()
  82. {
  83.     // TODO: clean up anything here.
  84. }
  85.  
  86. //=--------------------------------------------------------------------------=
  87. // C<<DEFOBJECTNAME>>::InternalQueryInterface
  88. //=--------------------------------------------------------------------------=
  89. // the controlling unknown will call this for us in the case where they're
  90. // looking for a specific interface.
  91. //
  92. // Parameters:
  93. //    REFIID        - [in]  interface they want
  94. //    void **       - [out] where they want to put the resulting object ptr.
  95. //
  96. // Output:
  97. //    HRESULT       - S_OK, E_NOINTERFACE
  98. //
  99. // Notes:
  100. //
  101. HRESULT C<<DEFOBJECTNAME>>::InternalQueryInterface
  102. (
  103.     REFIID riid,
  104.     void **ppvObjOut
  105. )
  106. {
  107.     CHECK_POINTER(ppvObjOut);
  108.  
  109.     // we support I<<DEFOBJECTNAME>> and ISupportErrorInfo
  110.     //
  111.     if (DO_GUIDS_MATCH(riid, IID_I<<DEFOBJECTNAME>>)) {
  112.         *ppvObjOut = (void *)(I<<DEFOBJECTNAME>> *)this;
  113.         AddRef();
  114.         return S_OK;
  115.     } else if (DO_GUIDS_MATCH(riid, IID_ISupportErrorInfo)) {
  116.         *ppvObjOut = (void *)(ISupportErrorInfo *)this;
  117.         AddRef();
  118.         return S_OK;
  119.     }
  120.  
  121.     // call the super-class version and see if it can oblige.
  122.     //
  123.     return CAutomationObject::InternalQueryInterface(riid, ppvObjOut);
  124. }
  125.  
  126.  
  127.  
  128. // TODO: implement your interface methods and property exchange functions
  129. //       here.
  130.  
  131.  
  132.